<template>
    <div>
        <el-scrollbar wrap-class="scrollbar-wrapper">
            <el-menu
                :default-active="$route.path"
                :default-openeds="openeds"
            >
                <sidebar-item v-for="route in routes" :key="route.filePath" :route="route" />
            </el-menu>
        </el-scrollbar>
    </div>
</template>

<script>
import SidebarItem from './SidebarItem'
import { getRouters } from '@/api/getCurrentUserMenu.js'
export default {
    name:"sidebar",
    components: { SidebarItem },
    data(){
        return{
            routes:{},
            openeds: ['/admin'],
        }
    },
    created(){
        getRouters({userId:this.$store.getters.userId}).then( res =>{
            // console.log(res.data.data);
            this.routes=res.data.data
        })
    },
    mounted(){

    },
    methods:{
        

    }
}
</script>

<style scoped >

</style>
